generate_computer_id

This function generates an ID unique to the current computer that the game is running on.

string generate_computer_id(string application_id, bool hardware_only)

Parameters:
application_id
A string that uniquely identifies your game.
hardware_only
A boolean specifying whether or not the function should only use information linked to the physical hardware in the machine.

Return value:
The generated computer ID on success, or a blank string on failure.

Remarks:
The ID that this function generates is based on several different hardware components of the machine that the game is running on. It is used often in registration systems where a piece of software is tied to a specific computer. For more information about how this ID might be used for this purpose, please see the article called Registration in BGT.

Please note that we cannot guarantee that this system will never be cracked. For more information on this, please refer to our end user license agreement as well as to the conclusion section of the article mentioned above.

The application ID that you specify is used to make the generated ID different from those generated by other BGT games. Without the application ID, the given ID would be the same for all BGT applications on a given computer. You must make certain that the application ID is not something that may be guessed by a third party, and that you only change it when you wish all your generated ID's to be different such as when you release a new major version of your game. Keeping the application ID as a string constant in your script is not desirable, instead it should be generated on the fly using some scrambling techniques of your choosing.

The hardware_only flag is used to indicate whether the function should limit itself to using hardware related information exclusively. If this is set to false then the function also uses information that changes for each installation of Windows, such as the hard drive serial assigned by the operating system when the drive was last formatted. This is not hard for the end user to change manually, but provides a much greater likelyhood that the final ID will indeed be unique. If this flag is set to true, then two computers with very similar or identical hardware may generate the exact same ID for a given application.

Example:
// Generate a unique computer ID for a dummy application.

void main()
{
alert("Product ID", generate_computer_id("my_dummy_app", false));
}